package metier;

import java.util.Date;

public class Reservation {
	
	private Date dateDebut;
	private Date dateFin;
	private Date dateRetour;
	private AgenceItf agenceDepart, agenceArrivee;
	private int id;
	//private static int IDENT_AUTO = 0;
	
	public Reservation(Date dateDebut, Date dateFin,AgenceItf agenceDepart, AgenceItf agenceArrivee) {
//		this.id = IDENT_AUTO++;
		this.id = (int) (Math.random()*1000);
		this.dateDebut = dateDebut;
		this.dateFin = dateFin;
		this.setAgenceDepart(agenceDepart);
		this.agenceArrivee= agenceArrivee;
		
//		dateRetour.setTime(dateDebut.getTime()+(dateFin.getTime()-dateDebut.getTime())*2);
		int d =  dateFin.getDay() - dateDebut.getDay();
		int m = dateFin.getMonth() - dateDebut.getMonth();
		int y = dateFin.getYear() - dateDebut.getYear();
		
		dateRetour = new Date(y, m ,d);
	}

	public Date getDateRetour() {
		return dateRetour;
	}

	public Date getDateDebut() {
		return dateDebut;
	}

	public void setDateDebut(Date dateDebut) {
		this.dateDebut = dateDebut;
	}

	public Date getDateFin() {
		return dateFin;
	}

	public void setDateFin(Date dateFin) {
		this.dateFin = dateFin;
	}

	public int getId() {
		return id;
	}
	
	public AgenceItf getAgenceArrivee() {
		return agenceArrivee;
	}

	public void setAgenceArrivee(AgenceItf agenceArrivee) {
		this.agenceArrivee = agenceArrivee;
	}

	public AgenceItf getAgenceDepart() {
		return agenceDepart;
	}

	public void setAgenceDepart(AgenceItf agenceDepart) {
		this.agenceDepart = agenceDepart;
	}
}
